﻿using PureMVC.Interfaces;
using PureMVC.Patterns.Command;
using PureMVC.Patterns.Mediator;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HidePanelCommand : SimpleCommand
{
    public override void Execute(INotification notification)
    {
        base.Execute(notification);
        //通过notification传入的mediator类型的参数来得到mediator中的view来控制
        Mediator m = notification.Body as Mediator;
        if (m!=null && m.ViewComponent != null)
        {
            //直接删除场景上的面板对象
            GameObject.Destroy((m.ViewComponent as MonoBehaviour).gameObject);
            //删除后要置空
            m.ViewComponent = null;
        }
    }
}
